<template>
  <div class="app-navigate">
    <div class="navigate-content">
      <div
        :class="active === '/' ? 'nav-item active' : 'nav-item'"
        @click="switchRouter('/')"
      >
        对话
      </div>
      <div   :class="active === '/action' ? 'nav-item active' : 'nav-item'" @click="switchRouter('/action')">功能</div>
    </div>
    <div class="user-navigate">
      <span class="iconfont">&#xe7e4;</span>
    </div>
  </div>
</template>
<script>
import { reactive,ref } from "vue";
import { useRouter } from "vue-router";

export default {
  name: "AppHeaderComponent",
  setup(props, ctx) {
    const active = ref("/");
    const router = useRouter();
    const switchRouter = (path) => {
      active.value = path;
      router.push(path);
    };
    return {
      active,
      switchRouter,
    };
  },
};
</script>
<style lang="scss">
    .app-navigate {
    width: 100%;
    height: 1rem;
    overflow: hidden;
    position: relative;

    .navigate-content {
        height: 100%;
        line-height: 100%;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;

        .nav-item {
            padding: 5px 10px;
            width: 60px;
            display: flex;
            justify-content: center;
            align-items: center;
            border-radius: 50px;

            &.active{
                background-color: rgb(172, 172, 172);
                color: white;
           
            }
        }

    }

    .user-navigate {
        position: absolute;
        top: 0;
        right: 0;
        height: 100%;
        width: 60px;
        display: flex;
        justify-content: center;
        align-items: center;
    }
}
</style>